// 根据路径匹配需要显示的菜单
export function mapPathToMenu(path: string, userMenus: any[]) {
  for (const menu of userMenus) {
    for (const subMenu of menu.children) {
      const route = path === subMenu.url
      if (route) {
        return subMenu
      }
    }
  }
}
// 根据路径匹配需要显示面包屑
export function mapPathToBread(path: string, userMenus: any[]) {
  const breasdArrs: any[] = []

  for (const menu of userMenus) {
    for (const subMenu of menu.children) {
      const route = path === subMenu.url
      if (route) {
        breasdArrs.push({ name: menu.name, path: menu.url })
        breasdArrs.push({ name: subMenu.name, path: subMenu.url })
      }
    }
  }
  return breasdArrs
}
